#include<bits/stdc++.h>
using namespace std;
#define xyf main
#define maxn 100000

int a[maxn],sz[maxn],l,s,t,m;
int dp[maxn];
int xyf()
{
	memset(dp,127,sizeof(dp));
	cin>>l>>s>>t>>m;
	for(int i=1;i<=m;++i)
		cin>>a[i];
	if(s==t)
	{
		int ans=0;
		for(int i=1;i<=m;++i)
			if(a[i]%s==0)
				ans++;
		cout<<ans;
		return 0;
	}
	sort(a,a+m+1);
	a[m+1]=l;
	for(int i=0;i<=m;++i)
		if(a[i+1]-a[i]>90)
			a[i+1]=a[i]+(a[i+1]-a[i])%90;
	for(int i=1;i<=m;++i)
		sz[a[i]]=1;
	for(int i=s;i<=t;++i)
	{
		if(sz[i])
			dp[i]=1;
		else
			dp[i]=0;
	}
	for(int i=2*s;i<=a[m+1];i++)
	{
		for(int j=s;j<=t;++j)
		{
			if(j>i)
				break;
			dp[i]=min(dp[i],dp[i-j]);
		}
		if(sz[i])
			dp[i]++;
	}
	cout<<dp[a[m+1]]<<endl;
}
